package com.gitee.wsl.ext.number


 fun Double.isNanOrInfinite() = this.isNaN() || this.isInfinite()

 fun Number.isPositive() = toDouble() > 0

 fun Number.isNegative() = toDouble() < 0

 fun Number.isNotZero() = toDouble() != 0.0


//相似等
/*fun Double.isAlmostEquals(other: Double, epsilon: Double = 0.000001): Boolean = (this - other).absoluteValue < epsilon

fun Double.isAlmostZero(): Boolean = kotlin.math.abs(this) <= 1e-19


fun Float.isNanOrInfinite() = this.isNaN() || this.isInfinite()

fun Float.isAlmostEquals(other: Float, epsilon: Float = 0.00001f): Boolean = (this - other).absoluteValue < epsilon

fun Float.isAlmostZero(): Boolean = kotlin.math.abs(this) <= 1e-6*/



/** Whether this [Byte] is even. */
val Byte.isEven: Boolean get():Boolean = this % 2 == 0

/** Whether this [Short] is even. */
 val Short.isEven: Boolean get():Boolean = this % 2 == 0

/** Whether this [Int] is even. */
 val Int.isEven: Boolean get():Boolean = this % 2 == 0

/** Whether this [Long] is even. */
 val Long.isEven: Boolean get():Boolean = this % 2L == 0L


/** Whether this [Byte] is odd. */
 val Byte.isOdd: Boolean get():Boolean = this % 2 != 0

/** Whether this [Short] is odd. */
 val Short.isOdd: Boolean get():Boolean = this % 2 != 0

/** Whether this [Int] is odd. */
 val Int.isOdd: Boolean get():Boolean = this % 2 != 0

/** Whether this [Long] is odd. */
 val Long.isOdd: Boolean get():Boolean = this % 2L != 0L


/** Whether this [UByte] is even. */
 val UByte.isEven: Boolean get():Boolean = this % 2u == 0u

/** Whether this [UShort] is even. */
 val UShort.isEven: Boolean get():Boolean = this % 2u == 0u

/** Whether this [UInt] is even. */
 val UInt.isEven: Boolean get():Boolean = this % 2u == 0u

/** Whether this [ULong] is even. */
 val ULong.isEven: Boolean get():Boolean = this % 2uL == 0uL


/** Whether this [UByte] is odd. */
 val UByte.isOdd: Boolean get():Boolean = this % 2u != 0u

/** Whether this [UShort] is odd. */
 val UShort.isOdd: Boolean get():Boolean = this % 2u != 0u

/** Whether this [UInt] is odd. */
 val UInt.isOdd: Boolean get():Boolean = this % 2u != 0u

/** Whether this [ULong] is odd. */
 val ULong.isOdd: Boolean get():Boolean = this % 2uL != 0uL
